home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / puzzle24 < prev    next >
Text File  |  1995-03-31  |  5KB  |  156 lines

  1. Article 1531 of comp.sys.handhelds:
  2. Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!samsung!cs.utexas.edu!uunet!munnari.oz.au!metro!news
  3. From: mcgovern@ee.su.oz.au ( )
  4. Newsgroups: comp.sys.handhelds
  5. Subject: puzzle-24 game for HP-48SX
  6. Message-ID: <1990Sep28.002305.23517@metro.ucc.su.OZ.AU>
  7. Date: 28 Sep 90 00:23:05 GMT
  8. Reply-To: mcgovern@ee.su.oz.au ( )
  9. Organization: Electrical Engineering, The University of Sydney, Australia
  10. Lines: 142
  11.  
  12. Hi netters,
  13.  
  14. I think I screwed up sending it so here it is (again ?)
  15.  
  16. Here's a game I wrote (for hp-48sx) a couple of weeks ago but couldn't send
  17. till now.  Its the puzzle-24 game.  I read that someone wrote
  18. a similar program using the chip8 interpreter.  I thought I'd send this
  19. anyway, it's rather hack out and its got a bug, but its still quiet playable.
  20.  
  21. The problem is that it creates a random layout of the pieces and this 
  22. doesn't always result in a puzzle which can be solved.  About ever second
  23. puzzle is solvable.  I wonder if the guy that wrote puzzle-15 knows of
  24. a test to see if the puzzle has a solution, or is the only way to do it
  25. scrambling a completed puzzle.  The program RARR creates an array of
  26. the number 1 to 24 in a random order, this is then used to place the
  27. pieces on the board.  I wonder if some sort of test can be performed on 
  28. this to see if the puzzle will have a solution.  I thought maybe taking
  29. the dot product with [1 2 ... 24 ] and testing if even, but this is not
  30. correct.
  31.  
  32. Load the directory PUZZLE, go into the the directory's CST menu, then
  33. to play run PLAY and use the arrow keys to move a piece adjacent to the 
  34. empty square into that square.  Due to extreme lazyness on my behalf 
  35. you need to use key y^x as the down arrow ; i.e.
  36.  
  37.             ^
  38.              <     >
  39.                y^x        
  40.  
  41.  
  42.                 Hamish McGovern
  43.                 mcgovern@ee.su.oz.au
  44.  
  45. Checksum: #8F42  Bytes: 1944
  46.  
  47. ---------------------------------------------
  48. %%HP: T(3)A(D)F(.);
  49. DIR
  50.   PLAY
  51.     \<< INIT 0 TIME
  52. 11 \-> KN T EM
  53.       \<<
  54.         WHILE 1
  55.         REPEAT
  56. "TIME: " TIME T
  57. HMS- 1 + \->STR 3 6
  58. SUB + 1 \->GROB PICT
  59. { # 50h # Ah } ROT
  60. REPL
  61.           IF KEY
  62.           THEN 35 -
  63. NEG \-> K
  64.             \<<
  65.               IF K
  66. ABS DUP 10 == SWAP
  67. 1 == OR
  68.               THEN
  69. EM 'K' STO+
  70. IF K 11 \>= K 55 \<= K
  71. 10 MOD DUP 6 \=/ SWAP
  72. 0 \=/ AND AND AND
  73. THEN K POS2PT PICT
  74. OVER K 11 + POS2PT
  75. SUB PICT ROT EMPTY
  76. REPL PICT EM POS2PT
  77. ROT REPL K 'EM' STO
  78. 1 'KN' STO+
  79. "KEYS: " KN \->STR +
  80. 1 \->GROB PICT {
  81. # 50h # 12h } ROT
  82. REPL
  83. END
  84.               END
  85.             \>>
  86.           END
  87.         END
  88.       \>>
  89.     \>>
  90.   CST { PLAY }
  91.   INIT
  92.     \<< RARR \-> RR
  93.       \<< ERASE {
  94. # 0h # 0h } PVIEW {
  95. # 9h # 9h } { # 3Dh
  96. # 3Dh } BOX 24 1
  97.         FOR N PIECE
  98. RR N GET GET PICT N
  99. 5 MOD 1 + N 5 / IP
  100. 1 + 10 * + POS2PT
  101. ROT REPL -1
  102.         STEP
  103.       \>> PICT { # Ah
  104. # Ah } EMPTY REPL
  105.     \>>
  106.   RARR
  107.     \<< 1 24
  108.       FOR V V
  109.       NEXT 24 \->ARRY
  110. 24 1
  111.       FOR B B RAND
  112. * 1 + FLOOR \-> Q
  113.         \<< Q OVER
  114. SWAP GET SWAP B
  115. OVER SWAP GET Q
  116. SWAP PUT B ROT PUT
  117.         \>> -1
  118.       STEP
  119.     \>>
  120.   EMPTY
  121. GROB 11 11 FF70FF70FF70FF70FF70FF70FF70FF70FF70FF70FF70
  122.   POS2PT
  123.     \<< DUP 10 MOD 10
  124. * R\->B SWAP 10 / IP
  125. 10 * R\->B 2 \->LIST
  126.     \>>
  127.   PIECE {
  128. GROB 11 11 FF70306010401340124012401240174010403060FF70
  129. GROB 11 11 FF70306010401740144017401140174010403060FF70
  130. GROB 11 11 FF70306010401740144017401440174010403060FF70
  131. GROB 11 11 FF70306010401540154017401440144010403060FF70
  132. GROB 11 11 FF70306010401740114017401440174010403060FF70
  133. GROB 11 11 FF70306010401640114017401540174010403060FF70
  134. GROB 11 11 FF70306010401740144012401140114010403060FF70
  135. GROB 11 11 FF70306010401740154017401540174010403060FF70
  136. GROB 11 11 FF70306010401740154017401440174010403060FF70
  137. GROB 11 11 FF7030601040D840945094509450D94010403060FF70
  138. GROB 11 11 FF7030601040DC40984098409840DD5010403060FF70
  139. GROB 11 11 FF7030601040DC5090509C509440DD5010403060FF70
  140. GROB 11 11 FF7030601040DC5090509C509050DD5010403060FF70
  141. GROB 11 11 FF7030601040D45094509C509050D15010403060FF70
  142. GROB 11 11 FF7030601040DC5094409C509050DD5010403060FF70
  143. GROB 11 11 FF7030601040D85094409C509450DD5010403060FF70
  144. GROB 11 11 FF7030601040DC50905098409440D54010403060FF70
  145. GROB 11 11 FF7030601040DC5094509C509450DD5010403060FF70
  146. GROB 11 11 FF7030601040DC5094509C509050DD5010403060FF70
  147. GROB 11 11 FF7030601040D9401550D5505450D94010403060FF70
  148. GROB 11 11 FF7030601040DD401940D9405840DD5010403060FF70
  149. GROB 11 11 FF7030601040DD501150DD505440DD5010403060FF70
  150. GROB 11 11 FF7030601040DD501150DD505050DD5010403060FF70
  151. GROB 11 11 FF7030601040D5501550DD505050D15010403060FF70
  152. }
  153. END
  154.  
  155.  
  156.